package net.lab1024.sa.admin.module.business.erp.bas.controller;

import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import net.lab1024.sa.admin.module.business.erp.bas.domain.entity.BomordEntity;
import net.lab1024.sa.admin.module.business.erp.bas.domain.form.BomordAddForm;
import net.lab1024.sa.admin.module.business.erp.bas.domain.form.BomordQueryForm;
import net.lab1024.sa.admin.module.business.erp.bas.domain.form.BomordUpdateForm;
import net.lab1024.sa.admin.module.business.erp.bas.domain.vo.BomordVO;
import net.lab1024.sa.admin.module.business.erp.bas.service.BomordService;
import net.lab1024.sa.base.common.domain.PageResult;
import net.lab1024.sa.base.common.domain.ResponseDTO;
import net.lab1024.sa.base.common.domain.ValidateList;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.validation.Valid;
import java.util.List;

/**
 * BOM表 Controller
 *
 * @Author AKITA
 * @Date 2025-08-11 22:28:03
 * @Copyright AKITA
 */

@RestController
@Tag(name = "BOM表")
public class BomordController {

    @Resource
    private BomordService bomordService;

    @Operation(summary = "分页查询 @author AKITA")
    @PostMapping("/bomord/queryPage")

    public ResponseDTO<PageResult<BomordVO>> queryPage(@RequestBody @Valid BomordQueryForm queryForm) {
        return ResponseDTO.ok(bomordService.queryPage(queryForm));
    }

    @Operation(summary = "添加 @author AKITA")
    @PostMapping("/bomord/add")

    public ResponseDTO<String> add(@RequestBody @Valid BomordAddForm addForm) {
        return bomordService.add(addForm);
    }

    @Operation(summary = "更新 @author AKITA")
    @PostMapping("/bomord/update")

    public ResponseDTO<String> update(@RequestBody @Valid BomordUpdateForm updateForm) {
        return bomordService.update(updateForm);
    }

    @Operation(summary = "批量删除 @author AKITA")
    @PostMapping("/bomord/batchDelete")

    public ResponseDTO<String> batchDelete(@RequestBody ValidateList<Integer> idList) {
        return bomordService.batchDelete(idList);
    }

    @Operation(summary = "单个删除 @author AKITA")
    @GetMapping("/bomord/delete/{bomId}")
    public ResponseDTO<String> batchDelete(@PathVariable Integer bomId) {
        return bomordService.delete(bomId);
    }

    @Operation(summary = "单个删除 @author AKITA")
    @GetMapping("/bomord/info/{id}")
    public ResponseDTO<List<BomordEntity>> info(@PathVariable Long id) {
        return bomordService.info(id);
    }
}
